package com.us.usws.site.ws.entity.channel.level2studentchannel;

import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonPropertyOrder;

import com.us.usws.biz.WSResourceURIReplacer;
import com.us.usws.common.SiteConstants;
import com.us.usws.model.flat.channel.DOChannel;

@JsonPropertyOrder({ "id", "title", "picture", "url", "ui_type", "total", "focused" })
public class WSLevel2StudentChannel {

	@JsonProperty("id")
	private String uid;

	@JsonProperty("title")
	private String name;

	private String picture;

	private String url;

	@JsonProperty("ui_type")
	private String uiType;

	@JsonProperty("total")
	private int videoCnt;

	private boolean focused = false;

	/**
	 * note this constructor will leave below fields as empty:
	 * url
	 * @param channel
	 * @param videos
	 */
	public WSLevel2StudentChannel(DOChannel channel) {
		this.uid = channel.getUid();
		this.name = channel.getName();
		this.picture = channel.getPicture();
		this.uiType = channel.getUiType();
		if (channel.getChannelTypeDsid() == SiteConstants.DSID_CHANNEL_TYPE_MEETING) {
			this.url = WSResourceURIReplacer.getChannelMeetingsURL(channel.getUid());
		} else {
			this.url = WSResourceURIReplacer.getChannelVideosListURL(channel.getUid());
		}
	}

	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPicture() {
		return picture;
	}

	public void setPicture(String picture) {
		this.picture = picture;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getUiType() {
		return uiType;
	}

	public void setUiType(String uiType) {
		this.uiType = uiType;
	}

	public int getVideoCnt() {
		return videoCnt;
	}

	public void setVideoCnt(int videoCnt) {
		this.videoCnt = videoCnt;
	}

	public boolean isFocused() {
		return focused;
	}

	public void setFocused(boolean focused) {
		this.focused = focused;
	}

}
